home *** CD-ROM | disk | FTP | other *** search
- with command_line;
- with util;
- with text_io;
- with voc_data;
- with voc_io;
- with voc_pc;
-
- procedure voc_show is
-
- package pk_io is new text_io.enumeration_io(voc_data.pack_types);
- package d_io is new text_io.fixed_io(duration);
- f:voc_io.handles;
- type handle_block_results is (finished,more_to_come);
-
- function handle_block return handle_block_results is
- b:voc_data.blocks;
- begin
- voc_io.read(f,b);
- text_io.new_line;
- case b.block_type is
- when voc_data.terminator =>
- return finished;
- when voc_data.voice_data =>
- text_io.put("sound "
- & integer'image(b.block_length)
- & "@"
- & integer'image(integer(b.sample_rate))
- & " "
- );
- pk_io.put(b.packing);
- voc_pc.play(b);
- when voc_data.silence =>
- text_io.put("silence ");
- d_io.put(b.silence_interval);
- voc_pc.play(b);
- when voc_data.marker =>
- text_io.put("marker=" & integer'image(integer(b.mark)));
- when voc_data.text =>
- text_io.put(b.text_string);
- when voc_data.start_repeat =>
- text_io.put("start repeat " & integer'image(integer(b.count)));
- when voc_data.end_repeat =>
- text_io.put("end repeat");
- when voc_data.voice_continuation =>
- text_io.put("voice_continuation"); -- should never happen!
- end case;
- return more_to_come;
- end handle_block;
-
- begin
- if command_line.parameter_count /= 1 then
- text_io.Put("usage:voc_show filename");
- util.halt(1);
- end if;
- voc_io.open(command_line.parameter(1),f);
- loop
- exit when handle_block = finished;
- end loop;
- voc_io.close(f);
- exception
- when voc_io.name_error =>
- text_io.put("Sorry, can't find file " & command_line.parameter(1));
- util.halt(1);
- end voc_show;